#ifndef USEDIALOG_H
#define USEDIALOG_H

#include <QDialog>
#include<QList>
#include<QMap>
#include<QLineEdit>
#include<QComboBox>

namespace Ui {
class UseDialog;
}

class UseDialog : public QDialog
{
    Q_OBJECT

public:
    explicit UseDialog(QWidget *parent = nullptr);
    explicit UseDialog(QWidget *parent,int windowFlag,const QMap<QString,QVariant> &userMap);
    ~UseDialog();

    QMap<QString,QVariant> checkMap;
    QMap<QString,QVariant> recheckMap;
    QMap<QString,QVariant> maintainMap;

    enum{ORGIN,ADDITEMS,CHANGEITEMS};

private slots:
    void on_checkBox_5_stateChanged(int arg1);

    void on_checkBox_4_stateChanged(int arg1);

    void on_checkBox_6_stateChanged(int arg1);

    void on_checkBox_stateChanged(int arg1);

    void on_maintainBox_stateChanged(int arg1);

    void on_pushButton_4_clicked();

    void on_confirmButton_clicked();

    void on_pushButton_5_clicked();

    void on_recheckBox_stateChanged(int arg1);

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_clicked();

    void on_checkNumber_textEdited(const QString &arg1);

    void on_recheckNumber_textEdited(const QString &arg1);

    void on_maintainNumber_textEdited(const QString &arg1);

private:
    Ui::UseDialog *ui;
    int windowFlag=ORGIN;
    QStringList tmpStrList={"不需要填状态值","需要填状态值"};

    QList<QLineEdit*> checkLineEditList;
    QList<QComboBox*> checkComboxList;
    QList<QLineEdit*> recheckLineEditList;
    QList<QComboBox*> recheckComboxList;
    QList<QLineEdit*> maintainLineEditList;
    QList<QComboBox*> maintainComboxList;

    QStringList checkList;
    QStringList recheckList;
    QStringList maintainList;

    QString jsonToStr(QList<QList<QVariant>>&);
    bool JsonToListList(const QString &msg, QList<QList<QVariant>> &list);

    void initAddItems();
    void initChangeItems();

    bool orginConfirm();
    void confirm();
    void addConfirm();
    void changeConfirm();
    QMap<QString,QVariant> userMap;
};

#endif // USEDIALOG_H
